﻿using Internal.KuiHuaBaoDian.Services.Audio;
using System.Collections.Generic;
using UnityEngine;

namespace KuiHuaBaoDian.Services.Audio {

    public interface IAudioContainer {

        IReadOnlyList<AudioClip> Clips { get; }

        IAudioModifier Modifier { get; }

        /// <summary>
        /// 是否参与全局限制
        /// </summary>
        bool IsParticipateGlobalLimit { get; }
    }

    public abstract class KHBD_AudioContainer : ScriptableObject, IAudioContainer, IAudioContainerInternal {

        protected KHBD_AudioContainer() : base() { }

        [SerializeField]
        private AudioClip[] m_Clips = new AudioClip[0];
        public IReadOnlyList<AudioClip> Clips => m_Clips;
        void IAudioContainerInternal.SetClips(AudioClip[] clips) {
            m_Clips = clips;
        }

        [SerializeField]
        private KHBD_AudioModifier m_Modifier = new();
        public IAudioModifier Modifier => m_Modifier;

        [SerializeField]
        [Header("是否参与全局限制")]
        private bool m_IsParticipateGlobalLimit;
        public bool IsParticipateGlobalLimit => m_IsParticipateGlobalLimit;
        void IAudioContainerInternal.SetIsParticipateGlobalLimit(bool value) {
            m_IsParticipateGlobalLimit = value;
        }
    }
}

namespace Internal.KuiHuaBaoDian.Services.Audio {

    public interface IAudioContainerInternal {

        void SetClips(AudioClip[] clips);

        void SetIsParticipateGlobalLimit(bool value);
    }
}